{include file="`$smarty.const.BASE`modules/common/views/_permission_icons.tpl"}
{permissions level=$smarty.const.UILEVEL_NORMAL}
<div class="actions">
    {if $permissions.create == 1}
    <a href="{link action=manage}" class="add">{$_TR.linktabs_manage}</a>
    {/if}
    </div>
 {/permissions}
 

<script type="text/javascript" src="/themes/kcms_edit/js/jquery.scrollTo-1.4.2-min.js"></script>

<div class="textmodule">
    <div class="textmodule_title">
        <h3 id="to_top">{$moduletitle}</h3>
    </div>
    <div class="services">
        <table border="0" style="padding: 0px 05px;" width="100%">
            <tr>
            {foreach name=links_data from=$links item=links_data}
                {if ($smarty.foreach.links_data.index > 0) &&  ($smarty.foreach.links_data.index)%2 == 0}
                    </tr>
                    <tr {if ($smarty.foreach.links_data.index+1)%4 == 3} class='tr_bg_row'{/if}>
                    {* If =0: we need to put one more td at the end of loop*}
                    {assign var='table_td_check' value=0}
                {else}
                    {assign var='table_td_check' value=1}
                {/if}
                <td width="50%">
                    <a href="#{$links_data->name}" rel="{$links_data->id}">{$links_data->name}</a>
                </td>
            {/foreach}
            {if $table_td_check == 0}
                <td width="50%">&nbsp;</td>
            {/if}
            </tr>
        </table>
    </div>
</div>

<br>
<br>
<div class="services_content">
    {foreach name=links_data from=$links item=links_data}
        <div class="service_item" rel="{$links_data->id}">
            <h3><a name="{$links_data->name}">{$links_data->name}</a></h3>
            <div class="body">{$links_data->description}</div>
            <div class="to_top"><a href="javascript:void(0);"> {$_TR.to_top}</a></div>
        </div>
        <br>
    {/foreach}
</div>

<script language="javascript">
    function goto_anchor_by_href()
    {ldelim}
        // get hash
        var hash = window.location.hash;
        if (hash == "")
            return;
       
       jQuery(".services table tr td a[href='"+hash+"']").trigger("click");
        
    {rdelim}
    
    jQuery(document).ready(function() {ldelim}
        jQuery(".services table tr td a").click(function(){ldelim}
            var id=jQuery(this).attr("rel");
            var item=jQuery(".services_content .service_item[rel="+id+"]")
            $.scrollTo( item, 800, {ldelim}{rdelim} );
            window.location.hash = jQuery(this).attr("href");
            return false;
        {rdelim});
        
        jQuery(".to_top").click(function(){ldelim}
            $.scrollTo(jQuery("#to_top"), 800, {ldelim}{rdelim} );
        {rdelim});
        
        goto_anchor_by_href();
    {rdelim});
</script>

{permissions level=$smarty.const.UILEVEL_NORMAL}
<div class="actions">
    {if $permissions.create == 1}
    <a href="{link action=manage}" class="add">{$_TR.linktabs_manage}</a>
    {/if}
    </div>
 {/permissions}
